class Grand_father(object):
    def __init__(self):
        print('爷爷')


class Father_left():
    def __init__(self):
        super().__init__()
        # Grand_father.__init__(self)
        print('左边爸爸')


class Father_right():
    def __init__(self):
        super().__init__()
        # Grand_father.__init__(self)
        print('右边爸爸')

class Mother(Grand_father):
    def __init__(self):
        # super(Mother, self).__init__()
        # Grand_father.__init__(self)
        print('妈妈')


class Me(Father_right, Father_left):
    _env = None
    def __init__(self):
        super(Me, self).__init__()
        # Father_left.__init__(self)
        # Father_right.__init__(self)
        self._env = self
        print('我')

    @staticmethod
    def get_instance():
        return Me._env


def main():
    me = Me()

class tt():
    _t = None
    def __init__(self):
        self.t = 1
        tt._t = 0
        pass

    @staticmethod
    def use(config=None):
        if config is None:
            config = 'ok'
        return config

#给每个类添加一个可变的数据属性
def Decorator(**kwargs):
    def add(obj):
        "添加数据属性"
        # print('调用外部函数的**kwargs',kwargs)
        for key,val in kwargs.items():
            # 添加数据属性
            setattr(obj,key,val)
        return obj
    # print("外部传入的参数为:",kwargs)
    return add

@Decorator(addr = "浙江省杭州市",name ="浙江大学")          #执行顺序:1.运行Decorator函数，先打印外部的传入的参数，返回add函数名；2.再执行School = add(School)
class School():
    def __init__(self,price):
        self.price =price

@Decorator(addr = "湖北省",price =12000)
class School1():
    pass



class EntityMeta(type):
    def __new__(cls,*args, **kwargs):
        cls = cls.__init__('')
        return cls
        # for key,value in kwargs.items():
        #     cls.__setattr__(key,value)


class Entity():
    # class Entity(metaclass=EntityMeta):
    def __init__(self,a='1',b=0,c=''):
        self.a = a
        self.b = b
        self.c = c

    def pr(self):
        print(self.a)


class Student(Entity):
    name = '1'
    age = 2
    nicky_name = 'a'

    # def __init__(self, name, age, nicky_name):
    #     self.name = name
    #     self.age = age
    #     self.nicky_name = nicky_name

    def __str__(self):
        return self.name





if __name__ == '__main__':
    # main()
    # a = Me('1')
    # b = Me('2')
    # print(a.t)
    # print(b.t)
    # print(Me.get_instance().t)
    s = Student()
    Student.pr()
    # s2 = Entity(a="test", b=12, c="toddy")
    # s2.age = -1
    # print(s2.nicky_name)
    # s2.nicky_name = 4444